package com.procurement.bidding.service.impl;

import com.procurement.bidding.mapper.PcmEvaluationRuleDetailMapper;
import com.procurement.bidding.service.PcmPublicAttachmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class PcmEvaluationRuleDetailService implements com.procurement.bidding.service.PcmEvaluationRuleDetailService {
    @Resource
    private PcmEvaluationRuleDetailMapper perdm;

    @Autowired
    private PcmPublicAttachmentService ppas;

    @Override
    public List<Map<String, Object>> selOpeningDetails(Long middleId) {
        List<Map<String, Object>> openingDetails = perdm.selOpeningDetails(middleId);
        openingDetails.forEach(e->{
            e.put("documents",ppas.selDocument(middleId, Long.valueOf(e.get("supplier_id").toString())));
        });
        return openingDetails;
    }
}
